package com.lww.feature.aop;

import org.aopalliance.intercept.MethodInterceptor;
import org.aopalliance.intercept.MethodInvocation;

/**
 * User: yian
 * Date: 2018/9/2
 */
public class SurroundAdvice implements MethodInterceptor {
    @Override
    public Object invoke(MethodInvocation methodInvocation) throws Throwable {
        Object[] objects = methodInvocation.getArguments();
        String name = (String)objects[0];
        System.out.println("环绕增强----前"+name);

        Object object = methodInvocation.proceed();    //此处执行的是原有函数

        System.out.println("环绕增强----后"+name);

        return object;
    }
}

